//
//  GatherSegmentInfo.m
//  YYTextTest
//
//  Created by macintosh on 16/9/12.
//  Copyright © 2016年 macintosh. All rights reserved.
//

#import "GatherSegmentInfo.h"

@implementation GatherSegmentInfo

+ (instancetype)infoWithTitle:(NSString *)title
                        items:(NSArray *)items
                firstSelected:(BOOL)firstSelected
                      enabled:(BOOL)enabled
{
    GatherSegmentInfo *info = [GatherSegmentInfo new];
    info.title = title;
    info.items = items;
    info.enabled = enabled;
    info.firstSelected = firstSelected;
    return info;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_title forKey:@"title"];
    [aCoder encodeBool:_firstSelected forKey:@"firstSelected"];
    [aCoder encodeBool:_enabled forKey:@"enabled"];
    [aCoder encodeObject:_items forKey:@"items"];
}

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
    GatherSegmentInfo *info = [GatherSegmentInfo new];
    info.title = [aDecoder decodeObjectForKey:@"title"];
    info.firstSelected = [aDecoder decodeBoolForKey:@"firstSelected"];
    info.enabled = [aDecoder decodeBoolForKey:@"enabled"];
    info.items = [aDecoder decodeObjectForKey:@"items"];
    return info;
}

- (id)copyWithZone:(NSZone *)zone {
    GatherSegmentInfo *info = [[[self class] allocWithZone:zone] init];
    info.title = self.title;
    info.items = self.items;
    info.enabled = self.enabled;
    info.firstSelected = self.firstSelected;
    return info;
}

@end
